package com.syswin.lhztest.nio.bio;

import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.Scanner;

/**
 * @author:lhz
 * @date:2018/12/10 21:08
 */
public class BIOClient {

	private static Charset charset = Charset.forName("utf-8");

	public static void main(String[] args) throws Exception {
		Socket socket = new Socket("localhost", 8080);
		OutputStream out = socket.getOutputStream();
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入:");
		String msg = scanner.nextLine();
		out.write(msg.getBytes(charset));
		scanner.close();

		//接受服务器端的响应
		socket.getInputStream();
		byte[] response = new byte[1024];

		socket.close();
	}
}
